n = input("Введите последовательность скобок: ")

def q(e):
    o = { ">": "<" , ")": "(",  "}": "{" , "]": "[" }
    s = []
   
    for c in e :
        if c in o.values():
            s.append(c)
        if c in o:
            if not s or o[c] != s.pop():
                return False
    return not s


print(q(n))

